<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <script src="../assets/flexible/flexible.debug.js"></script>
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>分类</title>
    <link rel="stylesheet" href="../css/reset.css">
    <link rel="stylesheet" href="../css/news.css">
    <link rel="stylesheet" href="../assets/swiper/css/swiper.min.css">
    <link rel="stylesheet" href="../assets/font/iconfont.css">
</head>

<body>
    <header class="header">
        全部分类
    </header>
    <section class="table">
        <article class="sidebar">
            <ul class="nav">
                <li class="curr">推荐分类</li>
                <li>中西药品</li>
                <li>成人药品</li>
                <li>家庭药箱</li>
                <li>健康体检</li>
                <li>医疗器械</li>
                <li>营养保健</li>
                <li>中药饮品</li>
                <li>隐形眼镜</li>
            </ul>
        </article>
        <div id="box_one">
            <section class="section">
                <ul class="nv-fz">

                </ul>
            </section>
            <section class="section">
                <ul class="nv-xb">

                </ul>
            </section>
            <section class="section">
                <ul class="nan-fz">

                </ul>
            </section>

            <section class="section">
                <ul class="nv-xb">

                </ul>
            </section>
            <section class="section">
                <ul class="nan-fz">

                </ul>
            </section>
            <section class="section">
                <ul class="nan-fz">

                </ul>
            </section>
            <section class="section">
                <ul class="nan-fz">

                </ul>
            </section>
            <section class="section">
                <ul class="nan-fz">

                </ul>
            </section>
        </div>
    </section>
    <footer class="footer">
        <dl class="time zhuye">
            <dt class="iconfont">&#xe6a9;</dt>
            <dd>主页</dd>
        </dl>
        <dl class="time news">
            <dt class="iconfont">&#xe6e3;</dt>
            <dd>分类</dd>
        </dl>
        <dl class="time dl service">
            <dt class="iconfont dt">&#xe501;</dt>
        </dl>
        <dl class="time gou">
            <dt class="iconfont">&#xe544;</dt>
            <dd>购物车</dd>
        </dl>
        <dl class="time personal">
            <dt class="iconfont">&#xe618;</dt>
            <dd>个人中心</dd>
        </dl>
    </footer>

    <script type="text/html" id="fenlei">
        {{each list value index}}
        <li><a href="{{value.aSrc}}"><img src="{{value.imgUrl}}"/></a><span>{{value.name}}</span></li>
        {{/each}}
    </script>
    <script type="text/html" id="nav">
        {{each list value index}}
        <li>{{value.name}}</li>
        {{/each}}
    </script>
    <script src="../assets/jquery/jquery-3.2.1.min.js"></script>
    <script src="../assets/js/template-web.js"></script>
    <script src="../assets/swiper/js/swiper.jquery.min.js"></script>
    <script>
        $(function () {
            $.ajax({
                type: "get",
                url: "../json/nav.json",
                success: function (data) {
                    var str = template("nav", { list: data });
                    $(".nav").html(str);
                    var section = document.getElementsByClassName("section");
                    var class1 = $(".section");
                    $(".nav li:first-child").addClass("curr");
                    $('.nav').children().click(function () {
                        var index = $(this).index();
                        $('#box_one').children().eq(index).show(300).siblings().hide(300)
                    })
                    console.log(class1);
                    $(".nav li").click(function () {
                        $(this).addClass("curr").siblings().removeClass("curr");
                        console.log(this);
                    })
                }
            });


            $.ajax({
                type: "get",
                url: "../json/nv-fz.json",
                success: function (data) {
                    var str = template("fenlei", { list: data });
                    $(".nv-fz").html(str);
                }
            });
            $.ajax({
                type: "get",
                url: "../json/nv-xb.json",
                success: function (data) {
                    var str = template("fenlei", { list: data });
                    $(".nv-xb").html(str);
                }
            });
            $.ajax({
                type: "get",
                url: "../json/nv-xb.json",
                success: function (data) {
                    var str = template("fenlei", { list: data });
                    $(".nan-fz").html(str);
                }
            });

            $(".fot li").eq(1).css("color", "#666");
            $(".fot li").click(function () {
                $(this).css("color", "#666").siblings().css("color", "#969696");

            })
        })

        $(".zhuye").click(function () {
            location.href = "../index.html"
        })
        $(".gou").click(function () {
            location.href = "../html/gou.html"
        })
        $(".service").click(function () {
            location.href = "../html/service.html"
        })
        $(".personal").click(function () {
            location.href = "../html/personal.html"
        })
    </script>
</body>

</html>